﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FasterFood
{
    public partial class PayPage : UserControl
    {
        public PayPage()
        {
            InitializeComponent();
        }

        // If a user hits any of the numbers 0-9 enter an asterisk
        private void hitNumber(object sender, EventArgs e)
        {
            if (PINTextBox.Text.Length < 4 )
            PINTextBox.Text = PINTextBox.Text + "*";
        }
        
        // clear button - Clears the text in the PIN textbox
        private void clearBtn_Click(object sender, EventArgs e)
        {
            PINTextBox.Text = "";
        }


        // Finish button - Verifies pin then moves to thank you page
        private void finishBtn_Click(object sender, EventArgs e)
        {
            // check to see if the pin entered is 4 digits long
            if (PINTextBox.Text.Length == 4)
            {

                // hide current page and display thank you page
                Form1.foodPages[7].Visible = false;
                Form1.foodPages[8].Visible = true;

            }

            // Else if the pin isn't 4 digits, display alert and reset text box.
            else
            {
                MessageBox.Show("Incorrect Pin, make sure you typed 4 digits and try again", "Incorrect Pin", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                PINTextBox.Text = "";
            }
           
        
        }

        // Back Button - Returns you to order review page
        private void backBtn_Click(object sender, EventArgs e)
        {
            Form1.foodPages[7].Visible = false;
            Form1.foodPages[6].Visible = true;
        }

        private void startOverBtn_Click(object sender, EventArgs e)
        {
            // hide current page and start over
            Form1.foodPages[7].Visible = false;
            Form1.foodPages[0].Visible = true;
        }
    }
}
